<?php 

$num = 10;
$fact = 1;
$show = '1* ';
for( $tmp=2 ; $tmp <= $num ; $tmp++) {
  
  $fact = $fact * $tmp;
  $show .= $tmp.'* ';
}
$show = rtrim($show, ' *');
echo "$show = $fact";

